/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package model.Entity.SIS;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author user12
 */
@Entity
@Table(name = "SIS_INSTRUCTORS")
@NamedQueries({
    @NamedQuery(name = "Instructor.findAll", query = "SELECT s FROM Instructor s"),
    @NamedQuery(name = "Instructor.findByInstructorId", query = "SELECT s FROM Instructor s WHERE s.instructorId = :instructorId"),
    @NamedQuery(name = "Instructor.findByInstructorName", query = "SELECT s FROM Instructor s WHERE s.instructorName = :instructorName"),
    @NamedQuery(name = "Instructor.findByInstructorNameS", query = "SELECT s FROM Instructor s WHERE s.instructorNameS = :instructorNameS"),
    @NamedQuery(name = "Instructor.findByNickname", query = "SELECT s FROM Instructor s WHERE s.nickname = :nickname"),
    @NamedQuery(name = "Instructor.findByNicknameS", query = "SELECT s FROM Instructor s WHERE s.nicknameS = :nicknameS"),
    @NamedQuery(name = "Instructor.findByNationalityCode", query = "SELECT s FROM Instructor s WHERE s.nationalityCode = :nationalityCode"),
    @NamedQuery(name = "Instructor.findByEmployeeId", query = "SELECT s FROM Instructor s WHERE s.employeeId = :employeeId"),
    @NamedQuery(name = "Instructor.findByIsFulltime", query = "SELECT s FROM Instructor s WHERE s.isFulltime = :isFulltime"),
    @NamedQuery(name = "Instructor.findByHrsLoad", query = "SELECT s FROM Instructor s WHERE s.hrsLoad = :hrsLoad"),
    @NamedQuery(name = "Instructor.findByCertificateCountry", query = "SELECT s FROM Instructor s WHERE s.certificateCountry = :certificateCountry"),
    @NamedQuery(name = "Instructor.findByCertificateYear", query = "SELECT s FROM Instructor s WHERE s.certificateYear = :certificateYear"),
    @NamedQuery(name = "Instructor.findByEmail", query = "SELECT s FROM Instructor s WHERE s.email = :email"),
    @NamedQuery(name = "Instructor.findByWorkPhone", query = "SELECT s FROM Instructor s WHERE s.workPhone = :workPhone"),
    @NamedQuery(name = "Instructor.findByHomePhone", query = "SELECT s FROM Instructor s WHERE s.homePhone = :homePhone"),
    @NamedQuery(name = "Instructor.findByAgreementDate", query = "SELECT s FROM Instructor s WHERE s.agreementDate = :agreementDate"),
    @NamedQuery(name = "Instructor.findByJoinDate", query = "SELECT s FROM Instructor s WHERE s.joinDate = :joinDate"),
    @NamedQuery(name = "Instructor.findByJoinBook", query = "SELECT s FROM Instructor s WHERE s.joinBook = :joinBook"),
    @NamedQuery(name = "Instructor.findByBookDate", query = "SELECT s FROM Instructor s WHERE s.bookDate = :bookDate"),
    @NamedQuery(name = "Instructor.findByIsProctor", query = "SELECT s FROM Instructor s WHERE s.isProctor = :isProctor"),
    @NamedQuery(name = "Instructor.findByProctoringPriority", query = "SELECT s FROM Instructor s WHERE s.proctoringPriority = :proctoringPriority"),
    @NamedQuery(name = "Instructor.findByPhysicalType", query = "SELECT s FROM Instructor s WHERE s.physicalType = :physicalType"),
    @NamedQuery(name = "Instructor.findByMaxLoad", query = "SELECT s FROM Instructor s WHERE s.maxLoad = :maxLoad"),
    @NamedQuery(name = "Instructor.findByIsActive", query = "SELECT s FROM Instructor s WHERE s.isActive = :isActive"),
    @NamedQuery(name = "Instructor.findByBirthDate", query = "SELECT s FROM Instructor s WHERE s.birthDate = :birthDate"),
    @NamedQuery(name = "Instructor.findByMaritalStatus", query = "SELECT s FROM Instructor s WHERE s.maritalStatus = :maritalStatus"),
    @NamedQuery(name = "Instructor.findByChildCounts", query = "SELECT s FROM Instructor s WHERE s.childCounts = :childCounts"),
    @NamedQuery(name = "Instructor.findByCityId", query = "SELECT s FROM Instructor s WHERE s.cityId = :cityId"),
    @NamedQuery(name = "Instructor.findByGender", query = "SELECT s FROM Instructor s WHERE s.gender = :gender"),
    @NamedQuery(name = "Instructor.findByIsSupervisor", query = "SELECT s FROM Instructor s WHERE s.isSupervisor = :isSupervisor"),
    @NamedQuery(name = "Instructor.findByIsDummy", query = "SELECT s FROM Instructor s WHERE s.isDummy = :isDummy"),
    @NamedQuery(name = "Instructor.findByWebName", query = "SELECT s FROM Instructor s WHERE s.webName = :webName"),
    @NamedQuery(name = "Instructor.findByWebPassword", query = "SELECT s FROM Instructor s WHERE s.webPassword = :webPassword"),
    @NamedQuery(name = "Instructor.findByIsWebEnabled", query = "SELECT s FROM Instructor s WHERE s.isWebEnabled = :isWebEnabled"),
    @NamedQuery(name = "Instructor.findByWebAdminType", query = "SELECT s FROM Instructor s WHERE s.webAdminType = :webAdminType"),
    @NamedQuery(name = "Instructor.findByEntryDate", query = "SELECT s FROM Instructor s WHERE s.entryDate = :entryDate"),
    @NamedQuery(name = "Instructor.findByTerminal", query = "SELECT s FROM Instructor s WHERE s.terminal = :terminal"),
    @NamedQuery(name = "Instructor.findByOsUser", query = "SELECT s FROM Instructor s WHERE s.osUser = :osUser"),
    @NamedQuery(name = "Instructor.findByIsAdvisor", query = "SELECT s FROM Instructor s WHERE s.isAdvisor = :isAdvisor"),
    @NamedQuery(name = "Instructor.findByAdvisorCapacity", query = "SELECT s FROM Instructor s WHERE s.advisorCapacity = :advisorCapacity"),
    @NamedQuery(name = "Instructor.findByIsLabSupervisor", query = "SELECT s FROM Instructor s WHERE s.isLabSupervisor = :isLabSupervisor"),
    //@NamedQuery(name = "Instructor.getFacultyInstructor", query = "SELECT s FROM Instructor s join fetch s.dept a join fetch a.instructor"),
    @NamedQuery(name = "Instructor.getFacultyInstructor", query = "SELECT s, d from Instructor s, Dept d WHERE s.dept.deptCode = d.deptCode "),
    @NamedQuery(name = "Instructor.getFacultyInstructorByFaculty", query = "SELECT s FROM Instructor s join fetch s.dept a join fetch a.instructor where a.id.facultyNo = :facultyNo")})
public class Instructor implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "INSTRUCTOR_ID")
    private Integer instructorId;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 60)
    @Column(name = "INSTRUCTOR_NAME")
    private String instructorName;
    @Size(max = 60)
    @Column(name = "INSTRUCTOR_NAME_S")
    private String instructorNameS;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 30)
    private String nickname;
    @Size(max = 30)
    @Column(name = "NICKNAME_S")
    private String nicknameS;
    @Basic(optional = false)
    @NotNull
    @Column(name = "NATIONALITY_CODE")
    private short nationalityCode;
    @Column(name = "EMPLOYEE_ID")
    private Integer employeeId;
    @Basic(optional = false)
    @NotNull
    @Column(name = "IS_FULLTIME")
    private short isFulltime;
    @Basic(optional = false)
    @NotNull
    @Column(name = "HRS_LOAD")
    private short hrsLoad;
    @Basic(optional = false)
    @NotNull
    @Column(name = "CERTIFICATE_COUNTRY")
    private short certificateCountry;
    @Basic(optional = false)
    @NotNull
    @Column(name = "CERTIFICATE_YEAR")
    private short certificateYear;
    // @Pattern(regexp="[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?", message="Invalid email")//if the field contains email address consider using this annotation to enforce field validation
    @Size(max = 60)
    private String email;
    @Size(max = 20)
    @Column(name = "WORK_PHONE")
    private String workPhone;
    @Size(max = 20)
    @Column(name = "HOME_PHONE")
    private String homePhone;
    @Column(name = "AGREEMENT_DATE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date agreementDate;
    @Column(name = "JOIN_DATE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date joinDate;
    @Size(max = 20)
    @Column(name = "JOIN_BOOK")
    private String joinBook;
    @Column(name = "BOOK_DATE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date bookDate;
    @Basic(optional = false)
    @NotNull
    @Column(name = "IS_PROCTOR")
    private short isProctor;
    @Column(name = "PROCTORING_PRIORITY")
    private Short proctoringPriority;
    @Basic(optional = false)
    @NotNull
    @Column(name = "PHYSICAL_TYPE")
    private short physicalType;
    @Basic(optional = false)
    @NotNull
    @Column(name = "MAX_LOAD")
    private short maxLoad;
    @Basic(optional = false)
    @NotNull
    @Column(name = "IS_ACTIVE")
    private short isActive;
    @Basic(optional = false)
    @NotNull
    @Column(name = "BIRTH_DATE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date birthDate;
    @Basic(optional = false)
    @NotNull
    @Column(name = "MARITAL_STATUS")
    private short maritalStatus;
    @Column(name = "CHILD_COUNTS")
    private Short childCounts;
    @Column(name = "CITY_ID")
    private Short cityId;
    @Basic(optional = false)
    @NotNull
    private short gender;
    @Basic(optional = false)
    @NotNull
    @Column(name = "IS_SUPERVISOR")
    private short isSupervisor;
    @Basic(optional = false)
    @NotNull
    @Column(name = "IS_DUMMY")
    private short isDummy;
    @Size(max = 100)
    @Column(name = "WEB_NAME")
    private String webName;
    @Size(max = 100)
    @Column(name = "WEB_PASSWORD")
    private String webPassword;
    @Column(name = "IS_WEB_ENABLED")
    private BigInteger isWebEnabled;
    @Column(name = "WEB_ADMIN_TYPE")
    private BigInteger webAdminType;
    @Basic(optional = false)
    @NotNull
    @Column(name = "ENTRY_DATE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date entryDate;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 30)
    private String terminal;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 30)
    @Column(name = "OS_USER")
    private String osUser;
    @Column(name = "IS_ADVISOR")
    private Short isAdvisor;
    @Column(name = "ADVISOR_CAPACITY")
    private Short advisorCapacity;
    @Column(name = "IS_LAB_SUPERVISOR")
    private Short isLabSupervisor;
    @OneToMany(mappedBy = "instructor")
    private List<Course> courseList;
    @OneToMany(mappedBy = "instructorId")
    private List<Faculty> facultyList;
    @OneToMany(mappedBy="instructor")
    private List<Dept> deptList;
    @JoinColumns({
        @JoinColumn(name = "FACULTY_NO", referencedColumnName = "FACULTY_NO"),
        @JoinColumn(name = "DEPT_NO", referencedColumnName = "DEPT_NO")})
    @ManyToOne(optional = false)
    private Dept dept;

    public Instructor() {
    }

    public Instructor(Integer instructorId) {
        this.instructorId = instructorId;
    }

    public Instructor(Integer instructorId, String instructorName, String nickname, short nationalityCode, short isFulltime, short hrsLoad, short certificateCountry, short certificateYear, short isProctor, short physicalType, short maxLoad, short isActive, Date birthDate, short maritalStatus, short gender, short isSupervisor, short isDummy, Date entryDate, String terminal, String osUser) {
        this.instructorId = instructorId;
        this.instructorName = instructorName;
        this.nickname = nickname;
        this.nationalityCode = nationalityCode;
        this.isFulltime = isFulltime;
        this.hrsLoad = hrsLoad;
        this.certificateCountry = certificateCountry;
        this.certificateYear = certificateYear;
        this.isProctor = isProctor;
        this.physicalType = physicalType;
        this.maxLoad = maxLoad;
        this.isActive = isActive;
        this.birthDate = birthDate;
        this.maritalStatus = maritalStatus;
        this.gender = gender;
        this.isSupervisor = isSupervisor;
        this.isDummy = isDummy;
        this.entryDate = entryDate;
        this.terminal = terminal;
        this.osUser = osUser;
    }

    public Integer getInstructorId() {
        return instructorId;
    }

    public void setInstructorId(Integer instructorId) {
        this.instructorId = instructorId;
    }

    public String getInstructorName() {
        return instructorName;
    }

    public void setInstructorName(String instructorName) {
        this.instructorName = instructorName;
    }

    public String getInstructorNameS() {
        return instructorNameS;
    }

    public void setInstructorNameS(String instructorNameS) {
        this.instructorNameS = instructorNameS;
    }

    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public String getNicknameS() {
        return nicknameS;
    }

    public void setNicknameS(String nicknameS) {
        this.nicknameS = nicknameS;
    }

    public short getNationalityCode() {
        return nationalityCode;
    }

    public void setNationalityCode(short nationalityCode) {
        this.nationalityCode = nationalityCode;
    }

    public Integer getEmployeeId() {
        return employeeId;
    }

    public void setEmployeeId(Integer employeeId) {
        this.employeeId = employeeId;
    }

    public short getIsFulltime() {
        return isFulltime;
    }

    public void setIsFulltime(short isFulltime) {
        this.isFulltime = isFulltime;
    }

    public short getHrsLoad() {
        return hrsLoad;
    }

    public void setHrsLoad(short hrsLoad) {
        this.hrsLoad = hrsLoad;
    }

    public short getCertificateCountry() {
        return certificateCountry;
    }

    public void setCertificateCountry(short certificateCountry) {
        this.certificateCountry = certificateCountry;
    }

    public short getCertificateYear() {
        return certificateYear;
    }

    public void setCertificateYear(short certificateYear) {
        this.certificateYear = certificateYear;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getWorkPhone() {
        return workPhone;
    }

    public void setWorkPhone(String workPhone) {
        this.workPhone = workPhone;
    }

    public String getHomePhone() {
        return homePhone;
    }

    public void setHomePhone(String homePhone) {
        this.homePhone = homePhone;
    }

    public Date getAgreementDate() {
        return agreementDate;
    }

    public void setAgreementDate(Date agreementDate) {
        this.agreementDate = agreementDate;
    }

    public Date getJoinDate() {
        return joinDate;
    }

    public void setJoinDate(Date joinDate) {
        this.joinDate = joinDate;
    }

    public String getJoinBook() {
        return joinBook;
    }

    public void setJoinBook(String joinBook) {
        this.joinBook = joinBook;
    }

    public Date getBookDate() {
        return bookDate;
    }

    public void setBookDate(Date bookDate) {
        this.bookDate = bookDate;
    }

    public short getIsProctor() {
        return isProctor;
    }

    public void setIsProctor(short isProctor) {
        this.isProctor = isProctor;
    }

    public Short getProctoringPriority() {
        return proctoringPriority;
    }

    public void setProctoringPriority(Short proctoringPriority) {
        this.proctoringPriority = proctoringPriority;
    }

    public short getPhysicalType() {
        return physicalType;
    }

    public void setPhysicalType(short physicalType) {
        this.physicalType = physicalType;
    }

    public short getMaxLoad() {
        return maxLoad;
    }

    public void setMaxLoad(short maxLoad) {
        this.maxLoad = maxLoad;
    }

    public short getIsActive() {
        return isActive;
    }

    public void setIsActive(short isActive) {
        this.isActive = isActive;
    }

    public Date getBirthDate() {
        return birthDate;
    }

    public void setBirthDate(Date birthDate) {
        this.birthDate = birthDate;
    }

    public short getMaritalStatus() {
        return maritalStatus;
    }

    public void setMaritalStatus(short maritalStatus) {
        this.maritalStatus = maritalStatus;
    }

    public Short getChildCounts() {
        return childCounts;
    }

    public void setChildCounts(Short childCounts) {
        this.childCounts = childCounts;
    }

    public Short getCityId() {
        return cityId;
    }

    public void setCityId(Short cityId) {
        this.cityId = cityId;
    }

    public short getGender() {
        return gender;
    }

    public void setGender(short gender) {
        this.gender = gender;
    }

    public short getIsSupervisor() {
        return isSupervisor;
    }

    public void setIsSupervisor(short isSupervisor) {
        this.isSupervisor = isSupervisor;
    }

    public short getIsDummy() {
        return isDummy;
    }

    public void setIsDummy(short isDummy) {
        this.isDummy = isDummy;
    }

    public String getWebName() {
        return webName;
    }

    public void setWebName(String webName) {
        this.webName = webName;
    }

    public String getWebPassword() {
        return webPassword;
    }

    public void setWebPassword(String webPassword) {
        this.webPassword = webPassword;
    }

    public BigInteger getIsWebEnabled() {
        return isWebEnabled;
    }

    public void setIsWebEnabled(BigInteger isWebEnabled) {
        this.isWebEnabled = isWebEnabled;
    }

    public BigInteger getWebAdminType() {
        return webAdminType;
    }

    public void setWebAdminType(BigInteger webAdminType) {
        this.webAdminType = webAdminType;
    }

    public Date getEntryDate() {
        return entryDate;
    }

    public void setEntryDate(Date entryDate) {
        this.entryDate = entryDate;
    }

    public String getTerminal() {
        return terminal;
    }

    public void setTerminal(String terminal) {
        this.terminal = terminal;
    }

    public String getOsUser() {
        return osUser;
    }

    public void setOsUser(String osUser) {
        this.osUser = osUser;
    }

    public Short getIsAdvisor() {
        return isAdvisor;
    }

    public void setIsAdvisor(Short isAdvisor) {
        this.isAdvisor = isAdvisor;
    }

    public Short getAdvisorCapacity() {
        return advisorCapacity;
    }

    public void setAdvisorCapacity(Short advisorCapacity) {
        this.advisorCapacity = advisorCapacity;
    }

    public Short getIsLabSupervisor() {
        return isLabSupervisor;
    }

    public void setIsLabSupervisor(Short isLabSupervisor) {
        this.isLabSupervisor = isLabSupervisor;
    }

    public List<Course> getCoursesList() {
        return courseList;
    }

    public void setCoursesList(List<Course> coursesList) {
        this.courseList = coursesList;
    }

    public List<Faculty> getFacultyList() {
        return facultyList;
    }

    public void setFacultyList(List<Faculty> facultyList) {
        this.facultyList = facultyList;
    }
    
	public List<Course> getCourseList() {
		return courseList;
	}

	public void setCourseList(List<Course> courseList) {
		this.courseList = courseList;
	}

	public List<Dept> getDeptList() {
		return deptList;
	}

	public void setDeptList(List<Dept> deptList) {
		this.deptList = deptList;
	}

	public Dept getDept() {
		return dept;
	}

	public void setDept(Dept dept) {
		this.dept = dept;
	}

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (instructorId != null ? instructorId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Instructor)) {
            return false;
        }
        Instructor other = (Instructor) object;
        if ((this.instructorId == null && other.instructorId != null) || (this.instructorId != null && !this.instructorId.equals(other.instructorId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "model.Instructor[ instructorId=" + instructorId + " ]";
    }
    
}
